<template>
	<div>
		<el-table :data="list" border style="width: 100%;margin-bottom:15px;">
			<el-table-column type="index" width="50">
			</el-table-column>
			<el-table-column prop="gname" label="商品名" width="280">
			</el-table-column>
			<el-table-column prop="username" label="评论用户" width="180">
			</el-table-column>
			<el-table-column prop="content" label="评论内容">
			</el-table-column>
			<el-table-column prop="time" label="评论时间" width="180">
			</el-table-column>
			<el-table-column label="操作" width="180">
				<template slot-scope="scope">
					<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination background layout="prev, pager, next" :total="total" :page-size="pageSize" @current-change="changePage">
		</el-pagination>
	</div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers("pl");
export default {
  name: "Pl",
  mounted() {
    this.getList();
  },
  computed: {
    ...mapState(["list",'total','pageSize'])
  },
  methods: {
    handleDelete(index, obj) {
			if(!confirm('确定要删除吗？')){
				return
			}
      this.del(obj.id)
    },
    ...mapActions(["getList", "getGname",'changePage','del'])
  }
};
</script>

<style>
</style>
